//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package test.集合.斗地主4.game;

import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.LayoutManager;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import test.集合.斗地主4.domain.User;
import test.集合.斗地主4.util.CodeUtil;

public class LoginJFrame extends JFrame implements MouseListener {
    User[] users = new User[]{new User("zhangsan", "123"), new User("lisi", "456")};
    JButton login = new JButton();
    JButton register = new JButton();
    JTextField username = new JTextField();
    JPasswordField password = new JPasswordField();
    JTextField code = new JTextField();
    JLabel rightCode = new JLabel();

    public LoginJFrame() {
        this.initJFrame();
        this.initView();
        this.setVisible(true);
    }

    public void initView() {
        Font usernameFont = new Font((String)null, 1, 16);
        JLabel usernameText = new JLabel("用户名");
        usernameText.setForeground(Color.white);
        usernameText.setFont(usernameFont);
        usernameText.setBounds(140, 55, 55, 22);
        this.getContentPane().add(usernameText);
        this.username.setBounds(223, 46, 200, 30);
        this.getContentPane().add(this.username);
        JLabel passwordText = new JLabel("密码");
        Font passwordFont = new Font((String)null, 1, 16);
        passwordText.setForeground(Color.white);
        passwordText.setFont(passwordFont);
        passwordText.setBounds(197, 95, 40, 22);
        this.getContentPane().add(passwordText);
        this.password.setBounds(263, 87, 160, 30);
        this.getContentPane().add(this.password);
        JLabel codeText = new JLabel("验证码");
        Font codeFont = new Font((String)null, 1, 16);
        codeText.setForeground(Color.white);
        codeText.setFont(codeFont);
        codeText.setBounds(215, 142, 55, 22);
        this.getContentPane().add(codeText);
        this.code.setBounds(291, 133, 100, 30);
        this.getContentPane().add(this.code);
        String codeStr = CodeUtil.getCode();
        Font rightCodeFont = new Font((String)null, 1, 15);
        this.rightCode.setForeground(Color.RED);
        this.rightCode.setFont(rightCodeFont);
        this.rightCode.setText(codeStr);
        this.rightCode.addMouseListener(this);
        this.rightCode.setBounds(400, 133, 100, 30);
        this.getContentPane().add(this.rightCode);
        this.login.setBounds(123, 310, 128, 47);
        this.login.setIcon(new ImageIcon("image\\login\\登录按钮.png"));
        this.login.setBorderPainted(false);
        this.login.setContentAreaFilled(false);
        this.login.addMouseListener(this);
        this.getContentPane().add(this.login);
        this.register.setBounds(256, 310, 128, 47);
        this.register.setIcon(new ImageIcon("image\\login\\注册按钮.png"));
        this.register.setBorderPainted(false);
        this.register.setContentAreaFilled(false);
        this.register.addMouseListener(this);
        this.getContentPane().add(this.register);
        JLabel background = new JLabel(new ImageIcon("test\\集合\\斗地主4\\image\\login\\background.png"));
        background.setBounds(0, 0, 633, 423);
        this.getContentPane().add(background);
    }

    public void initJFrame() {
        this.setSize(633, 423);
        this.setTitle("斗地主游戏 V1.0登录");
        this.setDefaultCloseOperation(3);
        this.setLocationRelativeTo((Component)null);
        this.setAlwaysOnTop(true);
        this.setLayout((LayoutManager)null);
    }

    public void mouseClicked(MouseEvent e) {
    }

    public void showJDialog(String content) {
        JDialog jDialog = new JDialog();
        jDialog.setSize(200, 150);
        jDialog.setAlwaysOnTop(true);
        jDialog.setLocationRelativeTo((Component)null);
        jDialog.setModal(true);
        JLabel warning = new JLabel(content);
        warning.setBounds(0, 0, 200, 150);
        jDialog.getContentPane().add(warning);
        jDialog.setVisible(true);
    }

    public void mousePressed(MouseEvent e) {
        if (e.getSource() == this.login) {
            this.login.setIcon(new ImageIcon("image\\login\\登录按下.png"));
        } else if (e.getSource() == this.register) {
            this.register.setIcon(new ImageIcon("image\\login\\注册按下.png"));
        }

    }

    public void mouseReleased(MouseEvent e) {
        if (e.getSource() == this.login) {
            this.login.setIcon(new ImageIcon("image\\login\\登录按钮.png"));
        } else if (e.getSource() == this.register) {
            this.register.setIcon(new ImageIcon("image\\login\\注册按钮.png"));
        }

    }

    public void mouseEntered(MouseEvent e) {
    }

    public void mouseExited(MouseEvent e) {
    }
}
